<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="data.User"%>
<!DOCTYPE html>
<html lang="zh">

<head>
	<meta charset="UTF-8">
	<title>作者信息</title>
</head>



<%

	String base_path = request.getScheme()
		+ "://"
		+ request.getServerName()
		+ ":"
		+ request.getServerPort()
		+ request.getContextPath();

%>


<%@ page import="data.User" %>
<%@ page import="data.Author" %>
<%

	boolean state_login = false;
	boolean is_author = false;
	
	Integer user_id = (Integer)session.getAttribute(User.Attribute.ID.getFullName());
	String username = (String)session.getAttribute(User.Attribute.USERNAME.getFullName());
	String password = (String)session.getAttribute(User.Attribute.PASSWORD.getFullName());
	
	if (username != null && password != null)
		if (User.checkUser(username, password))
			state_login = true;
	
	if (user_id != null)
		if (Author.hasAuthor(user_id))
			is_author = true;
%>


<script type="text/javascript">

	if (<%=state_login%> == false)
	{
		alert("请先登录账号");
		window.location.href = "../index.jsp";
	}
	
	if (<%=state_login%> && <%=is_author%> == false)
	{
		alert("你还未注册成为作者");
		window.location.href = "../index.jsp";
	}


</script>


<body>

	<br>
	<br>
	<br>
	<br>
	
	<span style="display:relative;">
		<label>用户ID：<%=session.getAttribute(User.Attribute.ID.getFullName())%></label>
		<br>
		<label>用户名：<%=session.getAttribute(User.Attribute.USERNAME.getFullName())%></label>
		<br>
		<label>笔名:<%=session.getAttribute(Author.Attribute.PEN_NAME.getFullName())%></label>
	</span>
	
	<br>
	<a href="#" onclick="javascript:history.back(-1);">返回上一页</a>


</body>



<style>


	span label{
		display: absolute;
		left: 30%;
	}

</style>


</html>














